home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / Import SYLK 1.0.cpt / Import SYLK 1.0 / card_2882.txt < prev    next >
Text File  |  1989-02-26  |  12KB  |  417 lines

  1. -- card: 2882 from stack: in.0
  2. -- bmap block id: 4329
  3. -- flags: 4000
  4. -- background id: 2296
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: 0003
  11. -- rect: left=8 top=306 right=341 bottom=63
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 1011 / 1011
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Home
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   visual dissolve to black
  23.   visual dissolve to white
  24.   visual dissolve to black
  25.   visual dissolve
  26.   go home
  27. end mouseUp
  28.  
  29.  
  30.  
  31. -- part 14 (button)
  32. -- low flags: 00
  33. -- high flags: 8003
  34. -- rect: left=3 top=97 right=133 bottom=148
  35. -- title width / last selected line: 0
  36. -- icon id / first selected line: 0 / 0
  37. -- text alignment: 1
  38. -- font id: 0
  39. -- text size: 12
  40. -- style flags: 0
  41. -- line height: 16
  42. -- part name: Import SYLK
  43. ----- HyperTalk script -----
  44. on mouseUp
  45.   global source,destination,uselevel,counter,temp1,temp2,temp3
  46.   put short name of this stack into temp3
  47.   Put "Which SYLK file do you wish to import?" into msg
  48.   show msg
  49.   put filename("TEXT") into source
  50.   if source is "cancel" then
  51.     hide msg
  52.     exitmouseup
  53.   end if
  54.   if source is empty then
  55.     hide msg
  56.     exit mouseUp
  57.   end if
  58.   open file source
  59.   put "Where do you want the data put?" into msg
  60.   show msg
  61.   put filename("STAK") into destination
  62.   if destination is "cancel" then
  63.     hide msg
  64.     exitmouseup
  65.   end if
  66.   if destination is empty then
  67.     hide msg
  68.     exit mouseUp
  69.   end if
  70.   put "Please wait while the file is imported..." into msg
  71.   set cursor to 4
  72.   set lockscreen to true
  73.   set lockmessages to true
  74.   go destination
  75.   go last card
  76.   put 1 into counter
  77.   repeat forever
  78.     repeat 100
  79.       read from file source until return
  80.       if it is empty then exit repeat
  81.       put it into line counter of temp1
  82.       get char 1 of line counter of temp1
  83.       if it is empty then exit repeat
  84.       if it is "c" then
  85.         get char 3 of line counter of temp1
  86.         if it is "y" then
  87.           put 1 into temp2
  88.           domenu "New Card"
  89.           repeat for the number of chars in line counter of temp1
  90.             get char 3 of line counter of temp1
  91.             if it is not "k" then
  92.               put empty into char 3 of line counter of temp1
  93.             else
  94.               put empty into char 3 of line counter of temp1
  95.               exit repeat
  96.             end if
  97.           end repeat
  98.           repeat for the number of chars in line counter of temp1
  99.             get char 3 of line counter of line counter of temp1
  100.             if it is quote then
  101.               put empty into char 3 of line counter of temp1
  102.             else
  103.               put it & " " into last char of field temp2
  104.               put empty into char 3 of line counter of temp1
  105.             end if
  106.           end repeat
  107.         end if
  108.         if it is "x" then
  109.           add 1 to temp2
  110.           repeat for the number of chars in line counter of temp1
  111.             get char 3 of line counter of temp1
  112.             if it is not "k" then
  113.               put empty into char 3 of line counter of temp1
  114.             else
  115.               put empty into char 3 of line counter of temp1
  116.               exit repeat
  117.             end if
  118.           end repeat
  119.           repeat for the number of chars in line counter of temp1
  120.             get char 3 of line counter of line counter of temp1
  121.             if it is quote then
  122.               put empty into char 3 of line counter of temp1
  123.             else
  124.               put it & " " into last char of field temp2
  125.               put empty into char 3 of line counter of temp1
  126.             end if
  127.           end repeat
  128.         end if
  129.         if it is "k" then
  130.           add 1 to temp2
  131.           repeat for the number of chars in line counter of temp1
  132.             get char 3 of line counter of temp1
  133.             if it is not "k" then
  134.               put empty into char 3 of line counter of temp1
  135.             else
  136.               put empty into char 3 of line counter of temp1
  137.               exit repeat
  138.             end if
  139.           end repeat
  140.           repeat for the number of chars in line counter of temp1
  141.             get char 3 of line counter of line counter of temp1
  142.             if it is quote then
  143.               put empty into char 3 of line counter of temp1
  144.             else
  145.               put it & " " into last char of field temp2
  146.               put empty into char 3 of line counter of temp1
  147.             end if
  148.           end repeat
  149.         end if
  150.         add 1 to counter
  151.       end if
  152.       if it is "e" then
  153.         go temp3
  154.         close file source
  155.         set lockscreen to false
  156.         beep 2
  157.         put "All done!" into msg
  158.         wait 5
  159.         hide msg
  160.         answer "Did any imported fields contain dates?" with "Yes" or "No"
  161.         if it is "Yes" then
  162.           answer "Convert to HyperCard format?" with "Yes" or "No"
  163.  
  164.           repeat while it is "Yes"
  165.             ask "Which field needs to be converted?"
  166.             put it into temp2
  167.             answer "Short Date, Long Date or Abbreviated Date?" with "Abbr" or "Long" or "Short"
  168.             put it into temp1
  169.             put "Ok, I'm off to convert that field..." into msg
  170.             set lockscreen to true
  171.             set lockmessages to true
  172.             go destination
  173.             go first card
  174.             Answer "Convert entire stack?" with "Yes" or "No"
  175.             if it is "Yes" then
  176.               put the number of cards into counter
  177.             else
  178.               ask "How many cards?"
  179.               put it into counter
  180.               ask "Starting with which card?"
  181.               go card it
  182.             end if
  183.             repeat for counter
  184.               if temp1 is "Long" then
  185.                 multiply field temp2 by 86400
  186.                 convert field temp2 to long date
  187.               end if
  188.               if temp1 is "abbr" then
  189.                 multiply field temp2 by 86400
  190.                 convert field temp2 to abbr date
  191.               end if
  192.               if temp1 is "short" then
  193.                 multiply field temp2 by 86400
  194.                 convert field temp2 to short date
  195.               end if
  196.               go next
  197.             end repeat
  198.             go temp3
  199.             set lockscreen to false
  200.             set lockmessages to false
  201.             beep 2
  202.             put "All done!" into msg
  203.             wait 5
  204.             hide msg
  205.             answer "Any more fields to convert?" with "Yes" or "No"
  206.           end repeat
  207.         end if
  208.         exit mouseup
  209.       end if
  210.     end repeat
  211.   end repeat
  212. end mouseup
  213.  
  214.  
  215.  
  216. -- part 20 (button)
  217. -- low flags: 80
  218. -- high flags: 8004
  219. -- rect: left=312 top=50 right=73 bottom=342
  220. -- title width / last selected line: 0
  221. -- icon id / first selected line: 0 / 0
  222. -- text alignment: 1
  223. -- font id: 0
  224. -- text size: 12
  225. -- style flags: 0
  226. -- line height: 16
  227. -- part name: OK
  228. ----- HyperTalk script -----
  229. on mouseUp
  230.   hide card field 2
  231.   hide card button 22
  232. end mouseUp
  233.  
  234.  
  235.  
  236. -- part 33 (button)
  237. -- low flags: 00
  238. -- high flags: 0003
  239. -- rect: left=447 top=305 right=340 bottom=502
  240. -- title width / last selected line: 0
  241. -- icon id / first selected line: 14767 / 14767
  242. -- text alignment: 1
  243. -- font id: 0
  244. -- text size: 12
  245. -- style flags: 0
  246. -- line height: 16
  247. -- part name: about…
  248. ----- HyperTalk script -----
  249. on mouseUp
  250.   visual dissolve to black
  251.   visual dissolve to white
  252.   visual dissolve to black
  253.   visual dissolve
  254.   go to card id 2462
  255. end mouseUp
  256.  
  257.  
  258.  
  259. -- part 35 (button)
  260. -- low flags: 00
  261. -- high flags: C000
  262. -- rect: left=426 top=12 right=74 bottom=512
  263. -- title width / last selected line: 0
  264. -- icon id / first selected line: 31685 / 31685
  265. -- text alignment: 1
  266. -- font id: 0
  267. -- text size: 12
  268. -- style flags: 0
  269. -- line height: 16
  270. -- part name: Help…
  271. ----- HyperTalk script -----
  272. on mouseUp
  273.   set lockscreen to true
  274.   show card field 1
  275.   show card button 6
  276.   set lockscreen to false
  277. end mouseUp
  278.  
  279.  
  280.  
  281. -- part 36 (field)
  282. -- low flags: 81
  283. -- high flags: 0007
  284. -- rect: left=119 top=156 right=342 bottom=372
  285. -- title width / last selected line: 0
  286. -- icon id / first selected line: 0 / 0
  287. -- text alignment: 0
  288. -- font id: 0
  289. -- text size: 12
  290. -- style flags: 0
  291. -- line height: 16
  292. -- part name: Help
  293.  
  294.  
  295. -- part 37 (button)
  296. -- low flags: 80
  297. -- high flags: 8003
  298. -- rect: left=216 top=139 right=163 bottom=304
  299. -- title width / last selected line: 0
  300. -- icon id / first selected line: 0 / 0
  301. -- text alignment: 1
  302. -- font id: 0
  303. -- text size: 12
  304. -- style flags: 0
  305. -- line height: 16
  306. -- part name: Close Help…
  307. ----- HyperTalk script -----
  308. on mouseUp
  309.   set lockscreen to true
  310.   hide card field 1
  311.   hide card button 6
  312.   set lockscreen to false
  313. end mouseUp
  314.  
  315.  
  316.  
  317. -- part 40 (button)
  318. -- low flags: 00
  319. -- high flags: 8003
  320. -- rect: left=157 top=97 right=133 bottom=302
  321. -- title width / last selected line: 0
  322. -- icon id / first selected line: 0 / 0
  323. -- text alignment: 1
  324. -- font id: 0
  325. -- text size: 12
  326. -- style flags: 0
  327. -- line height: 16
  328. -- part name: Convert Date
  329. ----- HyperTalk script -----
  330. on mouseUp
  331.   global source,destination,uselevel,counter,temp1,temp2,temp3
  332.   put the short name of this stack into temp3
  333.   put "Which stack needs converting?" into msg
  334.   show msg
  335.   put filename("STAK") into destination
  336.   if destination is "cancel" then
  337.     hide msg
  338.     exitmouseup
  339.   end if
  340.   if destination is empty then
  341.     hide msg
  342.     exit mouseUp
  343.   end if
  344.   Put "Yes" into it
  345.   repeat while it is "Yes"
  346.     ask "Which field needs to be converted?"
  347.     put it into temp2
  348.     answer "Short Date, Long Date or Abbreviated Date?" with "Abbr" or "Long" or "Short"
  349.     put it into temp1
  350.     put "Ok, I'm off to convert that field..." into msg
  351.     set lockscreen to true
  352.     set lockmessages to true
  353.     go destination
  354.     go first card
  355.     Answer "Convert entire stack?" with "Yes" or "No"
  356.     if it is "Yes" then
  357.       put the number of cards into counter
  358.     else
  359.       ask "How many cards?"
  360.       put it into counter
  361.       ask "Starting with which card?"
  362.       go card it
  363.     end if
  364.     repeat for counter
  365.       if temp1 is "Long" then
  366.         multiply field temp2 by 86400
  367.         convert field temp2 to long date
  368.       end if
  369.       if temp1 is "abbr" then
  370.         multiply field temp2 by 86400
  371.         convert field temp2 to abbr date
  372.       end if
  373.       if temp1 is "short" then
  374.         multiply field temp2 by 86400
  375.         convert field temp2 to short date
  376.       end if
  377.       go next
  378.     end repeat
  379.     go temp3
  380.     set lockscreen to false
  381.     set lockmessages to false
  382.     beep 2
  383.     put "All done!" into msg
  384.     wait 5
  385.     hide msg
  386.     answer "Any more fields to convert?" with "Yes" or "No"
  387.   end repeat
  388. end mouseup
  389.  
  390.  
  391.  
  392. -- part contents for card part 36
  393. ----- text -----
  394.  
  395. In order to use this stack to its fullest potential it will be neces-sary to do a couple of preliminary things.
  396.  
  397. 1.  Save a file as ‚ÄúSYLK‚Äù format.
  398.  
  399. 2.  Create a stack that has the same number of background fields as the ‚ÄúSYLK‚Äù file you are import-ing.
  400.  
  401. 3.  Push the ‚ÄúImport SYLK‚Äù button.
  402.  
  403. 4.  Follow the instructions and give it the information it needs and then sit back and wait.  If it seems slow, that's because it is.  The problem is not in the stack or scripts, but rather in HyperCard‚Ñ¢ itself.
  404.  
  405. 5.  Sit back and wait for it to finish.
  406.  
  407. 6.  Because of the way Microsoft products handle dates, it will be necessary to convert these imported dates to HyperCard‚Ñ¢ format.  This is handled by the 
  408. ‚ÄúImport SYLK‚Äù button, and also by the ‚ÄúConvert Date‚Äù button.  This is because you will have to know which field needs to be converted, and how many cards need to be converted, and the card/field  numbers associated with the conversion.  If you have to leave this stack to find this information after you finish importing, just hit the ‚ÄúConvert Date‚Äù button.  Other-wise, if you already know this info, you can just do it at the end of the data importation.
  409.  
  410. *** Custom applications are available.  If you are interested in a custom application, please contact me via the address on the next card.  Above all, let me know if you are happy, or upset with this stack.  Only then can I improve it.
  411.  
  412. Jeff Iverson
  413. (612) 537-8910 or
  414. (612) 872-0323
  415. Study Systems
  416. GEnie: APOSTASY
  417.